Skip to content

fix(cua-driver-rs)(linux): set_config {key,value} now persists (Closes #1923) - #1928

Merged
f-trycua merged 2 commits into
mainfrom
fix/cua-driver-rs-linux-set-config
Jun 18, 2026
Merged

fix(cua-driver-rs)(linux): set_config {key,value} now persists (Closes #1923)#1928
f-trycua merged 2 commits into
mainfrom
fix/cua-driver-rs-linux-set-config

Conversation

@f-trycua

@f-trycua f-trycua commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Problem

Closes #1923.

set_config '{"key":"max_image_dimension","value":800}' echoed the config back but the value never applied — get_config kept reporting the default 1568. Same for capture_mode. Windows' set_config works with the identical {key,value} shape.

Root cause

The Linux SetConfigTool only read the legacy per-field shape (top-level capture_mode / max_image_dimension keys). The {key, value} shape that the Swift/macOS and Windows callers send was never inspected, so the write was silently dropped.

Fix

Mirror the Windows SetConfigTool: dispatch on key to the same four known fields (capture_mode, max_image_dimension, experimental_pip, experimental_pip_geometry) with per-type validation, then fall through to the existing legacy per-field handling so both shapes work. get_config now reflects the written value immediately.

Verification

  • CI cd-rust-cua-driver.yml linux-x86_64 build (compile).
  • Runtime on an ephemeral Ubuntu 24.04 VM under Xvfb + dbus + AT-SPI: set_config {"key":"max_image_dimension","value":800} then get_config shows 800; same for capture_mode.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • SetConfigTool now accepts an alternative { "key", "value" } JSON input format for configuration updates, enabling persistence of settings like capture mode and image dimensions.
  • Tests

    • Added regression test to verify configuration value persistence across driver instances.

…#1923)

The Linux SetConfigTool only read the legacy per-field shape
(`{"capture_mode": ...}`, `{"max_image_dimension": ...}`). Callers
(Swift/macOS and Windows) send the `{"key": "...", "value": ...}` shape,
so a write like `{"key":"max_image_dimension","value":800}` was silently
dropped — get_config kept reporting the default 1568. Same for
capture_mode.

Mirror the Windows SetConfigTool: dispatch on `key` to the same four
known fields (capture_mode, max_image_dimension, experimental_pip,
experimental_pip_geometry) with per-type validation, then fall through
to the existing legacy per-field handling so both shapes work.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 18, 2026 1:12am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fa40a147-453d-420d-9d35-5712b81fe38c

📥 Commits

Reviewing files that changed from the base of the PR and between 3eb8fc1 and e256c1c.

📒 Files selected for processing (4)
  • .github/workflows/nix-build.yml
  • flake.nix
  • libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs
  • nix/cua-driver/tests/set-config.nix

📝 Walkthrough

Walkthrough

Fixes a Linux-only bug where SetConfigTool::invoke() silently ignored {key, value}-shaped set_config calls. The Rust implementation now dispatches on key, updating config fields in-memory or persisting them via pip_preview::write_config_key. A new NixOS VM integration test verifies the persistence end-to-end, and the test is registered in the flake and CI workflow matrix.

Changes

set_config {key,value} Fix and Regression Test

Layer / File(s) Summary
SetConfigTool schema and {key,value} dispatch
libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs
def() adds the {key,value} shape to the JSON schema; invoke() adds a new branch that dispatches on key, updating capture_mode/max_image_dimension in cfg and persisting experimental_pip/experimental_pip_geometry via pip_preview::write_config_key with type validation.
NixOS VM regression test
nix/cua-driver/tests/set-config.nix
Adds an embedded Python MCP stdio client that sends set_config {key,value} calls over JSON-RPC and asserts persistence via get_config; the NixOS harness boots the VM, starts Xvfb, runs the client, and asserts the success string in output.
Flake check registration and CI matrix wiring
flake.nix, .github/workflows/nix-build.yml
Registers cua-driver-set-config as an x86_64-linux flake check importing the new test, and adds the matching CI matrix entry with check_attr, timeout, and result_link.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • trycua/cua#1746: Introduced the initial cua-driver NixOS package, module, and integration test scaffolding that the new cua-driver-set-config flake check and VM test harness extend.

Poem

🐇 Hoppity-hop through the config store,
{key, value} writes that stuck no more!
The NixOS VM boots and checks the state,
max_image_dimension — finally great!
No longer a no-op, the values persist,
This bunny ticked bugs off the list! ✅

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cua-driver-rs-linux-set-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Linux visual regression artifacts

Matrix jobs now run independently. Download visual artifacts from this workflow run.
Each background-GUI job uploads a .gif of the interaction plus two annotated PNGs (<app>.png raw, <app>-atspi.png with AT-SPI element boxes); the cua-driver-linux-som-overlays artifact adds <app>-som.png cua Set-of-Marks overlays:

  • cua-driver-linux-cursor-click-gif
  • cua-driver-linux-background-terminal-gif
  • cua-driver-linux-parallel-drag-xserver
  • cua-driver-linux-background-gui-chromium
  • cua-driver-linux-background-gui-tk
  • cua-driver-linux-background-gui-gtk3-gedit
  • cua-driver-linux-background-gui-gtk3-mousepad
  • cua-driver-linux-background-gui-gtk3-scite
  • cua-driver-linux-background-gui-gtk4-characters
  • cua-driver-linux-background-gui-qt5-manuskript
  • cua-driver-linux-background-gui-qt5-klog
  • cua-driver-linux-background-gui-qt5-openambit
  • cua-driver-linux-background-gui-qt6-kate
  • cua-driver-linux-background-gui-qt6-kcalc
  • cua-driver-linux-background-gui-qt6-okular
  • cua-driver-linux-background-gui-qt6-qownnotes
  • cua-driver-linux-background-gui-electron-zettlr
  • cua-driver-linux-background-gui-electron-joplin
  • cua-driver-linux-background-gui-electron-logseq
  • cua-driver-linux-som-overlays

Open workflow run and download artifacts

Regression coverage for #1923 (fixed in #1928): a {key, value} set_config
write was silently dropped on Linux. Boots a NixOS VM, writes via the
{key, value} shape over MCP stdio, then reads back with get_config and
asserts max_image_dimension/capture_mode persisted. Wired as the
cua-driver-set-config flake check and a nix-build.yml matrix entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cua-driver-rs (Linux): set_config is a no-op — values never apply

1 participant